﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BBPA.Admin.SYS.Orders.GetMoney
{
    public partial class List : ListPage
    {
        BLL.V_Orders bllList = new BLL.V_Orders();
        BLL.Orders bll = new BLL.Orders();
        //
        BLL.Orders_State_Log bllOrders_State_Log = new BLL.Orders_State_Log();
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.BasicSQL = " State=" + (int)EnumHelper.OrdersState.GetMoney ;
        }
        public override void buildSQL_Page_List_search()
        {
        }
        public override DataSet get_Page_DataSet(string sql_, string orderby_, int pageFrom_, int pageTo_) { return bllList.GetListByPage(sql_, orderby_, pageFrom_, pageTo_); }
        public override void bat_Page_List(string inStr_,string action_)
        {
            if (action_ == "readybuy")
            {
                foreach (string id in inStr_.Split(','))
                {
                    int thisID = DataTypePlus.requestInt(id);
                    Model.Orders model = bll.GetModel(thisID);
                    model.State = (int)EnumHelper.OrdersState.ReadyBuy;//修改订单状态:ReadyBuy
                    bll.Update(model);
                    BLL.User_Operate_Log.Add(Security.GetCurrentUserID(), EnumHelper.TableName.Orders, thisID, EnumHelper.OperateType.Update, "修改订单状态:准备采购");
                    //订单状态日志
                    Model.Orders_State_Log modelOrders_State_Log = new Model.Orders_State_Log();
                    modelOrders_State_Log.OrdersID = thisID;
                    modelOrders_State_Log.State = model.State;
                    int Orders_State_LogID_new = bllOrders_State_Log.Add(modelOrders_State_Log);
                    BLL.User_Operate_Log.Add(Security.GetCurrentUserID(), EnumHelper.TableName.Orders_State_Log, Orders_State_LogID_new, EnumHelper.OperateType.Add, "确认准备采购");
                }
            }
        }
    }
}